package com.yanqu.road.server.cmd.activity.stronghold.wild;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.stronghold.StrongholdSilverDonate;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.activity.StrongholdWarCrossProto;
import com.yanqu.road.pb.activity.StrongholdWarProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.strongholdwar.StrongholdActivityMgr;
import com.yanqu.road.server.manger.activity.strongholdwar.StrongholdWarMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

import java.util.List;

@Cmd(code = GameProtocol.S_STRONGHOLD_WAR_MEMBER_SILVER_DONATE,desc = "成员银两捐献详情")
public class GetStrongholdMemberSilverDonateDataCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        StrongholdWarProto.StrongholdMemberSilverDonateDataRespMsg.Builder resp = StrongholdWarProto.StrongholdMemberSilverDonateDataRespMsg.newBuilder();
        String unionUid = player.getUserInfo().getUnionUid();
        ActivityInfo activityInfo = StrongholdActivityMgr.getOpenActivityInfo();
        StrongholdWarCrossProto.StrongholdCrossDonateSilverDetailReqMsg.Builder reqMsg = StrongholdWarCrossProto.StrongholdCrossDonateSilverDetailReqMsg.newBuilder();
        reqMsg.setActivityId(activityInfo.getActivityId());
        reqMsg.setUnionId(unionUid);
        player.sendUnionActivityGroupPacket(CrossProtocol.C_CROSS_STRONGHOLD_DONATE_SILVER_DETAIL, reqMsg, reqMsg.getActivityId());
       /* List<StrongholdSilverDonate> detaolList = StrongholdWarMgr.getSilverDonateDetail(activityInfo.getActivityId(), unionUid);
        for (StrongholdSilverDonate silverDonate : detaolList) {
            StrongholdWarProto.SilverDonateDataMsg.Builder builder = StrongholdWarProto.SilverDonateDataMsg.newBuilder();
            builder.setUserInfo(PlayerBasePb.parsePlayerBaseTempMsg(UserMgr.getUserBaseInfo(silverDonate.getUserId(), GameServer.getInstance().getServerId())));
            builder.setValue(silverDonate.getNum().toString());
            resp.addData(builder);
        }
        player.sendChannelPacket(ClientProtocol.U_STRONGHOLD_WAR_MEMBER_SILVER_DONATE, resp);*/
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
